﻿#region [InBrowser Using Statements]
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
#endregion

namespace ControlPanelOOB
{
    /// <summary>
    /// UserControl loaded if the application is running in the browser
    /// </summary>
    public partial class InBrowser : UserControl
    {
        #region [InBrowser Constructor]
        /// <summary>
        /// InBrowser Contructor
        /// </summary>
        public InBrowser()
        {
            InitializeComponent();
        }
        #endregion

        #region [InBrowser EventHandlers]
        /// <summary>
        /// EventHandler triggered when the user clicks the install button
        /// </summary>
        /// <param name="sender">Who triggered the event handler</param>
        /// <param name="e">Default RoutedEventArgs</param>
        private void InstallButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Application.Current.Install();
            }
            catch (InvalidOperationException opex)
            {
                MessageBox.Show(opex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Application could not be installed" + Environment.NewLine + ex.Message);
            }
        }
        #endregion
    }
}
